// 本地存储建议使用 Vue.ls, 实例请参考store getters

export function getItem(key) {
  try {
    const value = localStorage.getItem(key)
    if (value === null || value === undefined || value === '') {
      return null
    }
    return JSON.parse(localStorage.getItem(key))
  } catch (err) {
    return null
  }
}

export function setItem(key, value) {
  localStorage.setItem(key, JSON.stringify(value))
}

export function removeItem(key) {
  localStorage.removeItem(key)
}
